UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yF9We0LklswpULwFvS9PEcrSmep/F0Qzw8f0ft2bKHI='
WHERE
key_id = '14f56d1bacc99689c39ffa0fb5dc7496e5f1b6312df4e4c0a85927c9db689ce0'
AND (
token = 'yF9We0LklswpULwFvS9PEcrSmep/F0Qzw8f0ft2bKHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)