UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pSnrLGei59sFsjdZYSSPOGvdOvM7YHMEwm80xSr15p8='
WHERE
key_id = '217f42e65a2669ac9b70a2adcbbeaea8686b0600b68f9118df621fe11e704b01'
AND (
token = 'pSnrLGei59sFsjdZYSSPOGvdOvM7YHMEwm80xSr15p8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)