UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ayDsFniyHuYM1lZkZDWZmlrK8HzXLkToPXHLSrSOfwY='
WHERE
key_id = 'a703bc97da8b977017006e1410b99db46201546630c32b38b6078b4d5a73f29f'
AND (
token = 'ayDsFniyHuYM1lZkZDWZmlrK8HzXLkToPXHLSrSOfwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)