UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z0FGe1gALmZpIiDNM4PENcWgSXzlAEcfhUQ5WOYbEUM=' 
WHERE 
  key_id = '917e2bf08b6d6b4b1e0b672c5503e122559945b822229811952e6bd4d286f5e2' 
  AND (
    token = 'z0FGe1gALmZpIiDNM4PENcWgSXzlAEcfhUQ5WOYbEUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030