UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KGr34vjccOYE2ZTteRncdOo0oQVVp6HfG2axVZJQeeA=' 
WHERE 
  key_id = '5f3bdb001b5c2e3ae59a3529650bed452d3484316599a54eb8868985d67849e0' 
  AND (
    token = 'KGr34vjccOYE2ZTteRncdOo0oQVVp6HfG2axVZJQeeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021