UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOxndVv2KplvC110H41WJUwngDj0sXRWCYVTC5mijJ0=' 
WHERE 
  key_id = 'd5086b5f52daecf229ea84d12dab6cd79c4ceafb0c65f1800b7f6f1e4d7ec831' 
  AND (
    token = 'NOxndVv2KplvC110H41WJUwngDj0sXRWCYVTC5mijJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044