UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x6GumYiztT7sGJfF8w067SNWF8jO36vnj1j+KHMJ+CI=' 
WHERE 
  key_id = '2b58474e9daefe17400cee128935bfbf43da0a59e570662661f9fcb483a57ca3' 
  AND (
    token = 'x6GumYiztT7sGJfF8w067SNWF8jO36vnj1j+KHMJ+CI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024