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

Query time 0.00035