UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6lMkAAFNXldTok1X+iICOAF7NtPX8FAiKUiCyAppK0=' 
WHERE 
  key_id = '4d665fd4d4044430304620979c757cff6b8756f5956cd745b80abc8ba3877c83' 
  AND (
    token = 'H6lMkAAFNXldTok1X+iICOAF7NtPX8FAiKUiCyAppK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017