UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PhDjF/5cZe+3xHifmP0VT+4KhF+zTLjHVzIHCCLtB00='
WHERE
key_id = 'fcadaa53e9a3b235adfef2e6b1c46ce5210de9b5e016cc079c87cc1dded8d247'
AND (
token = 'PhDjF/5cZe+3xHifmP0VT+4KhF+zTLjHVzIHCCLtB00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)