UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ycBhX3GNmhTSIu5ZDfyzDKDQYAMLisjZX5PefbXIjlg='
WHERE
key_id = '7f3111d36e62d7f90c1023f13b401eed06859532554a1ba817c7733937fc64d1'
AND (
token = 'ycBhX3GNmhTSIu5ZDfyzDKDQYAMLisjZX5PefbXIjlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)