UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rm4wPf+ESJ0y4iI756iOyVa2jqul5mVl3dhIA9Uff8c='
WHERE
key_id = 'e87b39325e35c13e43c3f40f64b3a35ffff68145e9ca3e3e712fe5c2c7d0867c'
AND (
token = 'Rm4wPf+ESJ0y4iI756iOyVa2jqul5mVl3dhIA9Uff8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)