UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aNAvB8ETQljyhj9FBHl8rVfru1lXitUdJ8BhfccLONc='
WHERE
key_id = '6250d8dbb04edb713bc81ce0953ae5584c25c5a7e87be709b358e006a151bb2c'
AND (
token = 'aNAvB8ETQljyhj9FBHl8rVfru1lXitUdJ8BhfccLONc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)