UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J6PWQqMyxXcGxy9ITNHsPmH5IGAmtZ5GffkDDfQY6rc='
WHERE
key_id = '5af2fd3089392130f35a2db93c3a8bb2926ad5e62bd8f09103199f25ddffb862'
AND (
token = 'J6PWQqMyxXcGxy9ITNHsPmH5IGAmtZ5GffkDDfQY6rc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)