UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3CpUMNF+T3VfY5HDmmenRRYBMXVaJzESjwPYafbViVw=' 
WHERE 
  key_id = 'b7555a2dd20593ddf7b1451c1b511df2789b62d7070ae34c1c16839c37d68285' 
  AND (
    token = '3CpUMNF+T3VfY5HDmmenRRYBMXVaJzESjwPYafbViVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035