UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'msCbwvi6yrsWOqSVGEcGrCj473cvMCCphqXbDhX0KIM=' 
WHERE 
  key_id = 'fe13fc77bb401648057b783fbd25d44ad4d28fe4fdd24381d2ca93a4dae38e17' 
  AND (
    token = 'msCbwvi6yrsWOqSVGEcGrCj473cvMCCphqXbDhX0KIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029