UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dlPjAvgx8MGjTZ6v2q2NquC7g9yJvWowXobqj0GAg0U=' 
WHERE 
  key_id = '4ff02be2fbc6eb76b2df7ee393ae0c494fc946d0a3369d61d75865f4e8aabe08' 
  AND (
    token = 'dlPjAvgx8MGjTZ6v2q2NquC7g9yJvWowXobqj0GAg0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035