UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v4ztMQugSBFF55MPBCsa1v3F3LlKJPpqonUsZgMAyWI='
WHERE
key_id = 'aa3beb22e9a4fabd22bb50898ee3a83cea9a3eef79dc4b7196b294ec340d4f07'
AND (
token = 'v4ztMQugSBFF55MPBCsa1v3F3LlKJPpqonUsZgMAyWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)