UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sJ1da5JhV9KaPt1Y1fT924OwiiCeibKa/5LMQVosjKs='
WHERE
key_id = 'ff1203584b79f3123792b24c89f2bf1ac58b5a670549da21423acead96c4133a'
AND (
token = 'sJ1da5JhV9KaPt1Y1fT924OwiiCeibKa/5LMQVosjKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)