UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'drlwEc2VcV0j3lfypJBmLiIqfaLMYfzZGkcZOSAfZKI='
WHERE
key_id = '62ca30e14ef8a412e209363be94580b063dd6f40a25889caeb97e65ee4ce0d15'
AND (
token = 'drlwEc2VcV0j3lfypJBmLiIqfaLMYfzZGkcZOSAfZKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)