UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KfffIlmmWTgOTOWQcM6bcPhCTAaXVj4V+4MDwKuvL7Q=' 
WHERE 
  key_id = '472b5b7a80a303ecca4ba2eb082056131856aa945a67b3300377408e3cacd9bc' 
  AND (
    token = 'KfffIlmmWTgOTOWQcM6bcPhCTAaXVj4V+4MDwKuvL7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029