UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rOaX+23TYRdTPRb7/ZnlzIWt3qkD90VA33Ev+5hb2k8='
WHERE
key_id = 'e53e106f097b18abcf788867d482fc5d6109ecc854bcb5da6b4a3b4c2fe8422a'
AND (
token = 'rOaX+23TYRdTPRb7/ZnlzIWt3qkD90VA33Ev+5hb2k8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)