UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VkTXPDUnrH2cmli/cc5AuVoZPAuN8eWZF3kEXtwveoY=' 
WHERE 
  key_id = 'd48803c1cc9d99be976c7402055c98eb95af7acde21caabd06bc774a522091ed' 
  AND (
    token = 'VkTXPDUnrH2cmli/cc5AuVoZPAuN8eWZF3kEXtwveoY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024