UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BlK2fD935EbMqtON+XssCIW2BUVtXwxdQ4WRJQ5U0tM='
WHERE
key_id = 'babb05b77a44f5b8884a869dab2a4a62fc5859f18eedfdbeb5e06031709ac6ff'
AND (
token = 'BlK2fD935EbMqtON+XssCIW2BUVtXwxdQ4WRJQ5U0tM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)