UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zFhjMYWVYut9SK6kso1qAo1NmJjPVNACqF0wR8fLS2U=' 
WHERE 
  key_id = '99bcdbf44a6b00d9dc1e7a18b36b0540d34e11069ee98cb7f53f832c0f022749' 
  AND (
    token = 'zFhjMYWVYut9SK6kso1qAo1NmJjPVNACqF0wR8fLS2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082