UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y3Oc4jEH5K60FlhYBQOCdqkjMjNlWGbPem+SHSF4fdY=' 
WHERE 
  key_id = '19989e99e897b112cce00626ec633eb45bd3907ba8eb5f243aebb9eafc2fb7aa' 
  AND (
    token = 'y3Oc4jEH5K60FlhYBQOCdqkjMjNlWGbPem+SHSF4fdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034