UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P8vm/IJakGyhvwMVEpk1TyfXTQnuV6x7C//00g1eNo4='
WHERE
key_id = '40d32045892194cb2ba68d94ccdb0bdc29c861fad4279d80f1bfa309cf94e416'
AND (
token = 'P8vm/IJakGyhvwMVEpk1TyfXTQnuV6x7C//00g1eNo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)