UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LIob+QIjAJCknbRZvMeGQm2heqSDWzsvO366CTTVCxA=' 
WHERE 
  key_id = '3515da2485d2f86526d59e5981580b78f594e1221d3c24c3671aba34a86c3760' 
  AND (
    token = 'LIob+QIjAJCknbRZvMeGQm2heqSDWzsvO366CTTVCxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034