UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PQMj7I1AzZHVMZBT7ELVhgHouywRJFiiRDt8Pswxpqw='
WHERE
key_id = '85138fe198ced07fc655071b9e3884ded4cce2f439baa2820f44f57201fef3cc'
AND (
token = 'PQMj7I1AzZHVMZBT7ELVhgHouywRJFiiRDt8Pswxpqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)