UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x6mbuZaDFmaC0CIPSkn5LRdLgYlSKKO9iBIkh0PJPG0='
WHERE
key_id = '3651240e8af8e355680a5c31ca07d54de797b92142974f3047a7c7cc819b50a8'
AND (
token = 'x6mbuZaDFmaC0CIPSkn5LRdLgYlSKKO9iBIkh0PJPG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)