UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c5bs3perNFuGWiia8AwmJS6s1PiYBYXodKftQ5scjrA='
WHERE
key_id = '77fb1986fe2a6cf9ef5d4ac4eeccd758fba0f5012f5ed02e69ec0671e333b187'
AND (
token = 'c5bs3perNFuGWiia8AwmJS6s1PiYBYXodKftQ5scjrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)