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