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