UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2CCbFarjRGNRNZFx6zSjIvPDWbHllQonliVNSyW+zYs=' 
WHERE 
  key_id = '809b0aa74eea4fee5ac0eba4c14979b8ffc52ba365e1c5a8adb13d6301fd1ad8' 
  AND (
    token = '2CCbFarjRGNRNZFx6zSjIvPDWbHllQonliVNSyW+zYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025