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