UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bqfwzNRR0u0i9trEsx9KvosPbbxh7ul3JY/5ou29YxU='
WHERE
key_id = 'f03f8fd9ea52703304331777b0216c31414d38559bb757c35d0c2d30624e1be1'
AND (
token = 'bqfwzNRR0u0i9trEsx9KvosPbbxh7ul3JY/5ou29YxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)